//
//  MHSettingPublishPermissionViewModel.m
//  MiaoCircle
//
//  Created by 许正荣 on 2018/4/20.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHSettingPublishPermissionViewModel.h"
#import "MHCommonArrowItemViewModel.h"
#import "MHCommonSwitchItemViewModel.h"

@implementation MHSettingPublishPermissionViewModel
- (instancetype)initWithServices:(id<MHViewModelServices>)services params:(NSDictionary *)params{
    if (self = [super initWithServices:services params:params]) {
        self.info = params[MHViewModelUtilKey];
    }
    return self;
}

- (void)initialize{
    [super initialize];
    self.title = @"设置发表权限";
    MHCommonGroupViewModel *group0 = [MHCommonGroupViewModel groupViewModel];
    group0.header = @"谁可以发表内容";
    CGFloat limitWidth = MH_SCREEN_WIDTH - 2 * 20;
    CGFloat headerHeight0 = [group0.header mh_sizeWithFont:MHRegularFont_14 limitWidth:limitWidth].height + 5 *2;
    group0.headerHeight = headerHeight0;
    MHCommonGroupViewModel *group1 = [MHCommonGroupViewModel groupViewModel];
    MHCommonGroupViewModel *group2 = [MHCommonGroupViewModel groupViewModel];
    MHCommonItemViewModel *all = [MHCommonItemViewModel itemViewModelWithTitle:@"所有人" icon:@"circle_radio_normal"];
    all.selectIcon = @"circle_radio_sel";
//    all.isSelected = [self.info.publishAuth isEqualToString:@"1"];
    MHCommonItemViewModel *circleOwner = [MHCommonItemViewModel itemViewModelWithTitle:@"仅圈主" icon:@"circle_radio_normal"];
    circleOwner.selectIcon = @"circle_radio_sel";
//    circleOwner.isSelected = [self.info.publishAuth isEqualToString:@"2"];
    MHCommonItemViewModel *ownerAndManager = [MHCommonItemViewModel itemViewModelWithTitle:@"圈主、管理员" icon:@"circle_radio_normal"];
    ownerAndManager.selectIcon = @"circle_radio_sel";
//    ownerAndManager.isSelected = [self.info.publishAuth isEqualToString:@"3"];
    group0.itemViewModels = @[ all];
    group1.itemViewModels = @[ circleOwner];
    group2.itemViewModels = @[ ownerAndManager];
    self.dataSource = @[group0,group1,group2];
}

@end
